# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=python-execnet
pkgver=1.9.0
pkgrel=6
pkgdesc="Rapid multi-Python deployment"
arch=('any')
license=('MIT')
url="https://codespeak.net/execnet"
depends=('python')
makedepends=(
  'python-build'
  'python-installer'
  'python-setuptools-scm'
  'python-wheel'
)
checkdepends=(
  'openssh'
  'procps-ng'
  'python-py'
  'python-pytest'
  'python-pytest-timeout'
)
source=("https://pypi.io/packages/source/e/execnet/execnet-$pkgver.tar.gz")
sha512sums=('d425e7b6f3708efecb5dfa2c36a837cb55f2c32cf2ec0c1dc11cd1ca6ea614d119d04908b84dd5a3593c87db35e71fee202f843665c853ac3538479f60c83d60')

build() {
  cd execnet-$pkgver
  python -m build --wheel --no-isolation
}

check() {
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")

  cd execnet-$pkgver
  # install to temporary location, as importlib is used
  python -m installer --destdir=test_dir dist/*.whl
  export PYTHONPATH="test_dir/$site_packages:$PYTHONPATH"
  pytest -vv testing
}

package() {
  cd execnet-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}
